package com.kkb.service.impl;

import com.kkb.mapper.TbBrandMapper;
import com.kkb.pojo.TbBrand;
import com.kkb.pojo.TbBrandExample;
import com.kkb.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BrandServiceImpl implements BrandService {
    @Autowired
    private TbBrandMapper tbBrandMapper;
    @Override
    public List<TbBrand> getCommodity() {
        TbBrandExample example = new TbBrandExample();
        List<TbBrand> tbBrands = tbBrandMapper.selectByExample(example);
        return tbBrands;
    }

    @Override
    public int insertTbBrand(TbBrand tbBrand) {
        return tbBrandMapper.insert(tbBrand);
    }

    @Override
    public int deletebBrandById(Integer brandId) {
        return (int)tbBrandMapper.deleteByPrimaryKey(brandId);
    }

    @Override
    public int editbBrandById(Integer brandId) {
        return 0;
    }

    @Override
    public TbBrand SelectbBrandById(Integer brandId) {
        return tbBrandMapper.selectByPrimaryKey(brandId);
    }

    @Override
    public int updatebBrand(TbBrand tbBrand) {
        return tbBrandMapper.updateByPrimaryKeySelective(tbBrand);
    }
}
